package event

import (
	"time"

	"frame/internal/app/user/domain"
)

// UserCreated 代表一个用户被创建的事件
type UserCreated struct {
	UserID    string       `json:"user_id"`
	UserName  string       `json:"user_name"`
	UserEmail domain.Email `json:"user_email"`
	CreatedAt time.Time    `json:"created_at"`
}

// NewUserCreated 创建一个新的用户创建事件
func NewUserCreated(user *domain.User) *UserCreated {
	return &UserCreated{
		UserID:    user.ID,
		UserName:  user.Name,
		UserEmail: *user.Email,
		CreatedAt: time.Now(),
	}
}
